home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16575 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  765 b 

  1. Path: ix.netcom.com!als-il2-12
  2. From: stefmit@ix.netcom.com
  3. Newsgroups: comp.lang.c++
  4. Subject: [Q] Recursive mechanism
  5. Date: 11 Apr 1996 03:26:52 GMT
  6. Organization: Netcom
  7. Message-ID: <4khu5s$oop@dfw-ixnews1.ix.netcom.com>
  8. NNTP-Posting-Host: als-il2-12.ix.netcom.com
  9. X-NETCOM-Date: Wed Apr 10 10:26:52 PM CDT 1996
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. Could anybody explain the mechanism behind the following (broken) code:
  13. in a linked list: 
  14. void List<type> :: reverse (Node<type> *p) const
  15. { while ( p!= 0)
  16.     reverse (p -> next);
  17.     cout << p -> data; }
  18. that is, replacing if with while to get an infinite loop?
  19. How does it differ in the way of processing from the correct usage of if?
  20. NOTE: the first call is made with reverse(first_element_pointer)
  21. Thanks.
  22.